{extend name="wap/default_new/base" /}
{block name="resources"}
<style>
/* 分享弹出框 */
.mask-layer-bg{position: fixed;top: 0;bottom: 0;left: 0;right: 0;background: rgba(0, 0, 0, .8);z-index: 1000;}
.mask-layer-invite-friends{z-index:1001;position: fixed;width:100%;height:100%;top:10%;left:0;}
.mask-layer-invite-friends div{text-align: right;margin:10px 10px 30px;}
.mask-layer-invite-friends div img{width: 50px;}
.mask-layer-invite-friends h4{color:#ffffff;text-align: center;font-weight: bold;font-size:18px;}
.mask-layer-invite-friends h4 strong{color:#E02E24;}
.mask-layer-invite-friends a{display:block;text-align: center;color:#ffffff;font-weight: bold;background: #E02E24;padding: 5px 15px;width: 50%;border-radius: 3px;margin: 30px auto;}
/* 分享界面 */
.order-detail-wating-share{padding:10px 15px;background: #ffffff;}
.order-detail-wating-share time{padding: 2px 5px;background: #e5e5e5;color: #555;display: inline-block;position: relative;left: 50%;    transform: translateX(-50%);border-radius: 3px;}
.order-detail-wating-share label{font-size: 18px;margin: 10px auto;display: block;text-align: center;font-weight: bold;}
.order-detail-wating-share button{background: #f44;color: #ffffff;border: 1px solid #f44;padding: 7px;border-radius: 3px;margin:8px auto;display:block;width:90%;height: initial;line-height: initial;font-size: 14px;}
.order-detail-wating-share button:active{background: #e04141;}
.spelling-success{text-align: center;color: #f44;margin: 10px 0 0;font-size: 12px;}
.spelling-success em{font-style: normal;}

.group_detail{padding: 0px 10px;background: #fff;margin-top:10px;}
.group_detail .list-item{border-bottom: 1px solid #eee;}
.group_detail .list-item .user-list{padding:15px 0 0px 20px;margin:0;}
.group_detail .list-item .user-list li{position: relative;margin:0px 5px 10px 0;display:inline-block;}
.group_detail .list-item .user-list li .boss{position:absolute;left:-6px;top:-6px;background: #FFAB33;color:#333333;border-radius:10px;font-size:12px;padding:0 5px;}
.group_detail .list-item .user-list li img{width:40px;max-width: 100%;max-height: 100%;vertical-align: middle;border-radius:50%;}
.group_detail .goods_info{line-height: 40px;}
.group_detail .goods_info .item-title{	width: 30%;}
.group_detail .goods_info .goods_name{float: right;color: #777;white-space: nowrap;text-overflow: ellipsis;overflow:hidden;width: 70%;text-align: right;}
/*.group_detail .goods_info .goods_name::after{content:"";background: url(__TEMP__/{$style}/public/images/member_icon/icon_more.png) no-repeat right;background-size: auto 15px;float: right;display: inline-block;width: 10px;height: 40px;}*/
</style>
{/block}
{block name="goodsHead"}{/block}
{block name="main"}
{include file='wap/default_new/share'/}
<script>
$(function(){
	$.ajax({
		type:"post",
		url : "{:__URL('APP_MAIN/PintuanOrder/pintuanGetShareContents')}",
		data : {"shop_id" : "{$shop_id}" , "group_id" : "{$group_id}" , "goods_id" : "{$goods_id}"},
		success : function(data){
			{include file='wap/default_new/shareContents'/}
		}
	})
});
</script>
{niu:gettuangoudetail name="tuangou_detail" group_id="$group_id" goods_id="$goods_id"}
<section class="order-detail-wating-share">
	<time data-end-time="{$tuangou_group_info['end_time']}">00:00:00</time><br>
	<label>
		<span>还差<b>{$tuangou_group_info['poor_num']}</b>人，人满才算成功</span>	
	</label>
	<button id="invite_friends">邀请好友</button>
	<a href="{:__URL('APP_MAIN/goods/goodsdetail?id='.$tuangou_group_info["goods_id"].'&group_id='.$tuangou_group_info["group_id"])}"><button style="background: #fff;color: #f44;">一键参团</button></a>
</section>

<section class="group_detail">
	<div class="list-item">
		<ul class="user-list">
			<?php $is_boos = 0; ?>
			{foreach name="$tuangou_group_info['user_list']" item="vo"}
			<li>
				{if condition="$vo.uid == $tuangou_group_info['group_uid'] && $is_boos == 0"}
				<span class="boss">拼主</span>
				<?php $is_boos = 1; ?>
				{/if}
				{if condition="$vo.user_headimg"}
				<img src="{:__IMG($default_headimg)}" class="lazy_load" data-original="{:__IMG($vo.user_headimg)}"/>
				{else/}
				<img src="{:__IMG($default_headimg)}"/>
				{/if}
			</li>
			{/foreach}
			{for start="0" end="$tuangou_group_info['poor_num']" step="1"}
			<li>
				<img src="__TEMP__/{$style}/public/images/spelling_who.png"/>
			</li>
			{/for}
		</ul>
	</div>
	<div class="list-item goods_info">
		<span class="item-title">商品名称</span>
		<a href="{:__URL('APP_MAIN/goods/goodsdetail','id='.$tuangou_group_info["goods_id"])}"><span class="goods_name">{$tuangou_group_info.goods_name}</span></a>
	</div>
</section>

<div class="mask-layer-bg"></div>
<div class="mask-layer-invite-friends">
	<div><img src="__TEMP__/{$style}/public/images/invite-friends_share.png"/></div>
	<h4>还差<strong>{$tuangou_detail['tuangou_num']-$tuangou_detail['real_num']}</strong>人，点击右上角发送给好友</h4>
	<!-- <a href="{:__URL('APP_MAIN/goods/goodsdetail?id='.$tuangou_detail['goods_id'].'&group_id='.$tuangou_detail['group_id'])}">参与拼单</a> -->
</div>
<input type="hidden" id="ms_time" value="{niu:currenttime/}"/>
{/niu:gettuangoudetail}
{/block}
{block name="javascript"}
<script>
$(function(){
	$(".mask-layer-bg,.mask-layer-invite-friends").click(function(){
		$(".mask-layer-bg,.mask-layer-invite-friends").hide();
	})

	$("#invite_friends").click(function(){
		$(".mask-layer-bg,.mask-layer-invite-friends").show();
	})
})

commonCountDown($(".order-detail-wating-share time").attr("data-end-time"),$(".order-detail-wating-share time"));

function commonCountDown(time,obj){
	if(null != time && "" != time){
		var sys_second = (time-$("#ms_time").val());///1000;
		if(sys_second>1){
			sys_second -= 1;
			var day = Math.floor((sys_second / 3600) / 24);
			var hour = Math.floor((sys_second / 3600) % 24);
			var minute = Math.floor((sys_second / 60) % 60);
			var second = Math.floor(sys_second % 60);
			var s_hour = hour<10?"0"+hour:hour;
			var s_minute = minute<10?"0"+minute:minute;
			var s_second = second<10?"0"+second:second;
			var str = s_hour + ":" + s_minute + ":" + s_second;
			obj.text(str);
		}else{
			obj.text("拼单已结束");
		}
		var timer = setInterval(function(){
			if (sys_second > 1) {
				sys_second -= 1;
				var day = Math.floor((sys_second / 3600) / 24);
				var hour = Math.floor((sys_second / 3600) % 24);
				var minute = Math.floor((sys_second / 60) % 60);
				var second = Math.floor(sys_second % 60);
				var s_hour = hour<10?"0"+hour:hour;
				var s_minute = minute<10?"0"+minute:minute;
				var s_second = second<10?"0"+second:second;
				var str = s_hour + ":" + s_minute + ":" + s_second;
				obj.text(str);
			} else { 
				obj.text("拼单已结束");
				clearInterval(timer);
			}
		}, 1000);
	}
}

</script>
{/block}
{block name="bottom"}{/block}